package com.yx.modules.api.controller;


import com.yx.common.utils.PageUtils;
import com.yx.common.utils.Query;
import com.yx.common.utils.R;
import com.yx.modules.api.annotation.LoginUser;
import com.yx.modules.api.entity.TbUser;
import com.yx.system.entity.TdWalletPayLog;
import com.yx.system.service.TdWalletPayLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 钱包交易记录
 */
@RestController
@RequestMapping("/api/walletpay")
public class TdWalletPayLogController {

    @Autowired
    private TdWalletPayLogService tdWalletPayLogService;


    /**
     * 获取列表
     *
     * @param params
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public R list(@LoginUser TbUser tbUser,@RequestParam Map<String, Object> params) {
        //查询列表数据
        params.put("uuid", tbUser.getUuid());
        Query query = new Query(params);
        //获取对应商品
        List<TdWalletPayLog> tdWalletPayLogs = tdWalletPayLogService.queryList(query);
        int total = tdWalletPayLogService.queryTotal(query);
        PageUtils pageUtil = new PageUtils(tdWalletPayLogs, total, query.getLimit(), query.getPage());
        return R.ok().put("page", pageUtil);
    }


}
